<template>
  <div>
    <Row class="search-info-style">
      <Col span="6">
        <span style="">姓&#12288;&#12288;名：</span>
        <Input style="width: 70%;" v-model="searchInfo.name" />
      </Col>
      <Col span="6">
        <span style="">身份证号：</span>
        <Input style="width: 70%;" v-model="searchInfo.card_no" />
      </Col>
      <Col span="6">
        <span style="">联系电话：</span>
        <Input style="width: 70%;" v-model="searchInfo.phone" />
      </Col>
      <Col span="6" style="text-align: center">
        <Button class="new-btn-sty" @click="findInit()"><Icon type="ios-search" />搜索</Button>
      </Col>
    </Row>
    <Row class="search-info-style">
      <Col span="6">
        <span style="">党委职务：</span>
        <Select style="width: 70%;" v-model="searchInfo.dwzw">
          <Option v-for="item in labelList.dwzw" :key="item.number" :value="item.number">{{ item.type_name }}</Option>
        </Select>
      </Col>
      <Col span="6">
        <span style="">居委职务：</span>
        <Select style="width: 70%;" v-model="searchInfo.jwzw">
          <Option v-for="item in labelList.jvwzw" :key="item.number" :value="item.number">{{ item.type_name }}</Option>
        </Select>
      </Col>
      <Col span="6">
        <span style="">监委职务：</span>
        <Select style="width: 70%;" v-model="searchInfo.jwcy">
          <Option v-for="item in labelList.jwzw" :key="item.number" :value="item.number">{{ item.type_name }}</Option>
        </Select>
      </Col>
    </Row>
    <Row  class="search-info-style">
      <Col span="6" >
        <span style="">协会职务：</span>
        <Select style="width: 70%;" v-model="searchInfo.xhzw">
          <Option v-for="item in labelList.xhzw" :key="item.number" :value="item.number">{{ item.type_name }}</Option>
        </Select>
      </Col>
      <Col span="6">
        <span style="">政治面貌：</span>
        <Select style="width: 70%;" v-model="searchInfo.zzmm">
          <Option v-for="item in labelList.zzmm" :key="item.number" :value="item.number">{{ item.type_name }}</Option>
        </Select>
      </Col>
<!--      <Col span="6">-->
<!--        <span style="">婚姻状况：</span>-->
<!--        <Select style="width: 70%;" v-model="searchInfo.hunyin">-->
<!--          <Option v-for="item in labelList.hunyin" :key="item.number" :value="item.number">{{ item.type_name }}</Option>-->
<!--        </Select>-->
<!--      </Col>-->
      <Col span="6">
        <span style="">民&#12288;&#12288;族：</span>
        <Select style="width: 70%;" v-model="searchInfo.minzu">
          <Option v-for="item in labelList.minzu" :key="item.number" :value="item.number">{{ item.type_name }}</Option>
        </Select>
      </Col>
<!--      <Col span="6">-->
<!--        <span style="">社工状态：</span>-->
<!--        <Select style="width: 70%;" v-model="searchInfo.state">-->
<!--          <Option v-for="item in labelList.statusList" :key="item.number" :value="item.number">{{ item.type_name }}</Option>-->
<!--        </Select>-->
<!--      </Col>-->
    </Row>
    <Row class="search-info-style" >
      <Col span="6" v-if="this.$store.state.user.severUserInfo.company_grade === '2'">
        <span>所在区县：</span>
        <Select v-model="searchInfo.city_code" filterable transfer="" clearable @on-change="getMailList2(4,searchInfo.city_code)" style="width:70%">
          <Option :value="item.code" v-for="item in mailList1" v-bind:key="item.code">{{item.name}}</Option>
        </Select>
      </Col>
      <Col span="6" v-if="this.$store.state.user.severUserInfo.company_grade === '2' || this.$store.state.user.severUserInfo.company_grade === '3'">
        <span>所在街道：</span>
        <Select v-model="searchInfo.street_code" filterable transfer="" clearable @on-change="getMailList2(5, searchInfo.street_code)" style="width:70%">
          <Option :value="item.code" v-for="item in mailList2" v-bind:key="item.code">{{item.name}}</Option>
        </Select>
      </Col>
      <Col span="6" v-if="this.$store.state.user.severUserInfo.company_grade === '2' || this.$store.state.user.severUserInfo.company_grade === '3' || this.$store.state.user.severUserInfo.company_grade === '4'">
        <span>所在社区：</span>
        <Select v-model="searchInfo.community_code" filterable transfer="" clearable style="width:70%">
          <Option :value="item.code" v-for="item in mailList3" v-bind:key="item.code">{{item.name}}</Option>
        </Select>
      </Col>
    </Row>
    <Table :columns="columns" :data="list" border style="margin-top: 10px">
      <template slot-scope="{ row }" slot="type">
        <div v-for="item in labelList.typeList" :key="item.number">
          <span v-if="item.number === row.type">{{ item.type_name }}</span>
        </div>
      </template>
      <template slot-scope="{ row }" slot="status">
        <div v-for="item in labelList.statusList" :key="item.number">
          <span v-if="item.number === row.state">{{ item.type_name }}</span>
        </div>
      </template>
      <template slot-scope="{ row }" slot="action">
<!--        <Button type="primary" size="small" style="margin-right: 10px" v-if="companyGrade === '2' && row.type === '1' && row.state === '11'" @click="getTransfer(row,'1');">市内调动</Button>-->
<!--        <Button type="primary" size="small" style="margin-right: 10px" v-if="companyGrade === '3' && row.type === '1' && row.state === '11'" @click="getTransfer(row,'2')">区内调动</Button>-->
<!--        <Button type="primary" size="small" style="margin-right: 10px" v-if="companyGrade === '4' && row.type === '1' && row.state === '11'" @click="getTransfer(row,'3')">街道内调动</Button>-->
<!--        <Button type="primary" size="small" style="margin-right: 10px" v-if="companyGrade === '5' && row.type === '1' && row.state === '11'" @click="transfer(row)">人员调动</Button>-->
        <Button type="primary" size="small" style="margin-right: 10px" @click="getInfo(row)">查看</Button>
<!--        <Button type="primary" size="small" style="margin-right: 10px" v-if="companyGrade === '5' && (row.state === '11' || row.state === '40')" @click="checkInfo(row)">编辑</Button>-->
<!--        <Button type="info" size="small" style="margin-right: 10px" v-if="companyGrade === '5' && row.state === '50'" @click="checkInfDraft(row)">编辑</Button>-->
<!--        <Button type="warning" size="small" style="margin-right: 10px" v-if="companyGrade === '5' && row.state === '11'" @click="logOut(row)">注销</Button>-->
<!--        <Button type="warning" size="small" style="margin-right: 10px" v-if="companyGrade === '5' && row.state === '30'" @click="getQuota(row)">信息比对</Button>-->
<!--        <Button type="warning" size="small" style="margin-right: 10px" v-if="row.state !== '50' && row.state !== '20'" @click="getHistoryQuota(row)">历史记录</Button>-->
<!--        <Button type="error"  size="small" style="margin-right: 10px" v-if="companyGrade === '5' && row.state === '50'" @click="deleteInfo(row)">删除</Button>-->
      </template>
    </Table>
    <Page :total="searchInfo.totalnum" class="page_style" :current="searchInfo.pageNo"
          :page-size="searchInfo.pageSize" @on-change="changePageNo" show-total show-elevator show-sizer @on-page-size-change="changePagesize"/>

    <Modal v-model="transferModal" title="人员调动" width="700" cancel-text="关闭"
           @on-ok="okTransfer()" @on-cancel="transferModal=false" ok-text="确定">
      <Row class="bench_search">
        <Col span="4" align="center">调出区县</Col>
        <Col span="8">
          <Select disabled v-model="transferInfo.out_city_code" filterable transfer="" clearable @on-change="getMailList4(4,transferInfo.out_city_code)">
            <Option :value="item.code" v-for="item in mailList5" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
        <Col span="4" align="center">调出街道</Col>
        <Col span="8">
          <Select disabled v-model="transferInfo.out_street_code" filterable transfer="" clearable @on-change="getMailList4(5, transferInfo.out_street_code)">
            <Option :value="item.code" v-for="item in mailList6" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
      </Row>
      <Row class="bench_search">
        <Col span="4" align="center">调出社区</Col>
        <Col span="8">
          <Select disabled v-model="transferInfo.out_community_code" filterable transfer="" clearable>
            <Option :value="item.code" v-for="item in mailList7" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
        <Col span="4" align="center">姓名</Col>
        <Col span="8">
          <Input disabled type="text" v-model="transferInfo.name"></Input>
        </Col>
      </Row>
      <Row class="bench_search">
        <Col span="4" align="center">调入区县</Col>
        <Col span="8">
          <Select v-model="transferInfo.put_city_code" filterable transfer="" clearable @on-change="getMailList2(4,transferInfo.put_city_code)">
            <Option :value="item.code" v-for="item in mailList1" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
        <Col span="4" align="center">调入街道</Col>
        <Col span="8">
          <Select v-model="transferInfo.put_street_code" filterable transfer="" clearable @on-change="getMailList2(5, transferInfo.put_street_code)">
            <Option :value="item.code" v-for="item in mailList2" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
      </Row>
      <Row class="bench_search">
        <Col span="4" align="center">调入社区</Col>
        <Col span="8">
          <Select v-model="transferInfo.put_community_code" filterable transfer="" clearable>
            <Option :value="item.code" v-for="item in mailList3" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
      </Row>
    </Modal>

    <Modal v-model="transferModal2" title="人员调动" width="700" cancel-text="关闭"
           @on-ok="okTransfer2()" @on-cancel="transferModal2=false" ok-text="确定">
      <Row class="bench_search">
        <Col span="4" align="center">调出区县</Col>
        <Col span="8">
          <Select disabled v-model="transferInfo.out_city_code" filterable transfer="" clearable @on-change="getMailList4(4,transferInfo.out_city_code)">
            <Option :value="item.code" v-for="item in mailList5" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
        <Col span="4" align="center">调出街道</Col>
        <Col span="8">
          <Select disabled v-model="transferInfo.out_street_code" filterable transfer="" clearable @on-change="getMailList4(5, transferInfo.out_street_code)">
            <Option :value="item.code" v-for="item in mailList6" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
      </Row>
      <Row class="bench_search">
        <Col span="4" align="center">调出社区</Col>
        <Col span="8">
          <Select disabled v-model="transferInfo.out_community_code" filterable transfer="" clearable>
            <Option :value="item.code" v-for="item in mailList7" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
        <Col span="4" align="center">姓名</Col>
        <Col span="8">
          <Input disabled type="text" v-model="transferInfo.name"></Input>
        </Col>
      </Row>
      <Row class="bench_search">
        <Col span="4" align="center">调入区县</Col>
        <Col span="8">
          <Select v-if="status" v-model="transferInfo.put_city_code" filterable transfer="" clearable @on-change="getMailList2(4,transferInfo.put_city_code)">
            <Option :value="item.code" v-for="item in mailList1" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
          <Select v-if="!status" disabled v-model="transferInfo.put_city_code" filterable transfer="" clearable @on-change="getMailList2(4,transferInfo.put_city_code)">
            <Option :value="item.code" v-for="item in mailList1" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
        <Col span="4" align="center">调入街道</Col>
        <Col span="8">
          <Select v-if="status2" v-model="transferInfo.put_street_code" filterable transfer="" clearable @on-change="getMailList2(5, transferInfo.put_street_code)">
            <Option :value="item.code" v-for="item in mailList2" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
          <Select v-if="!status2" disabled v-model="transferInfo.put_street_code" filterable transfer="" clearable @on-change="getMailList2(5, transferInfo.put_street_code)">
            <Option :value="item.code" v-for="item in mailList2" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
      </Row>
      <Row class="bench_search">
        <Col span="4" align="center">调入社区</Col>
        <Col span="8">
          <Select v-model="transferInfo.put_community_code" filterable transfer="" clearable>
            <Option :value="item.code" v-for="item in mailList3" v-bind:key="item.code">{{item.name}}</Option>
          </Select>
        </Col>
      </Row>
    </Modal>
    <Modal  v-model="logOutShow" title="注销" width="700" cancel-text="关闭"
            @on-ok="logOutOk()" @on-cancel="logOutShow=false" ok-text="确定">
      <Row class="bench_search">
        <Col span="4" style="top: 6px;" align="center">注销原因</Col>
        <Col span="8">
          <Select v-model="deleteData.lzyy" filterable transfer="" style="width: 100%;" @on-change="changeCancellation()">>
            <Option v-for="item in labelList.lzyy" :key="item.number" :value="item.number">{{item.type_name}}</Option>
          </Select>
        </Col>
      </Row>
      <Row v-if="deleteData.lzyy === '4'" class="bench_search">
        <Col span="4" style="top: 6px;" align="center">其他原因</Col>
        <Col span="8">
          <Input type="text" v-model="deleteData.lzyy_other"  style="width: 100%;"></Input>
        </Col>
      </Row>
    </Modal>
    <new-check-info ref="chile"></new-check-info>
    <check-personnel-list ref="history"></check-personnel-list>
  </div>
</template>
<script>
import newCheckInfo from '@/components/newCheckInfo'
import checkPersonnelList from '@/components/newCheckPersonnelList'
import { getTypeList, getOffice } from '@/api/personInfo'
import { findPersonneOutList, updateWorkerMobilize, updatePersonnelWorker, deleteDraft, updateLogOut } from '@/api/worker'
export default {
  components: {checkPersonnelList, newCheckInfo },
  data() {
    return {
      deleteData: {
        lzyy_other: ''
      },
      logOutShow: false,
      status: true,
      status2: true,
      status3: false,
      mailList1: [], mailList2: [], mailList3: [], mailList4: [], mailList5: [], mailList6: [], mailList7: [],
      transferModal: false,
      transferInfo: {},
      columns: [
        { type: 'index', width: 60, align: 'center' },
        { title: '姓名', key: 'name', align: 'center'},
        { title: '证件号码', key: 'card_no', align: 'center'},
        { title: '联系方式', key: 'phone', align: 'center'},
        { title: '人员类型', slot: 'type', align: 'center'},
        { title: '所在区县', key: 'city_name', align: 'center'},
        { title: '所在街道', key: 'street_name', align: 'center'},
        { title: '所在社区', key: 'community_name', align: 'center'},
        // { title: '社工状态', slot: 'status', align: 'center'},
        { title: '操作', slot: 'action', width: '300', align: 'center', fixed: 'right' },
      ],
      transferModal2: false,
      list: [],
      companyGrade: '',
      labelList: { typeList: [], statusList: [], hunyin: [], minzu: [], zzmm: [], dwzw: [], jwzw: [], jvwzw: [], xhzw: [], zgxl: [], xw: [], shgzs: [], qsgx: [], khjg: [], khxx: [], lzyy: [] },
      searchInfo:{
        totalnum: 0,
        pageNo: 1,
        pageSize:10
      }
    }
  },
  methods: {
    findInit () {
      this.searchInfo.pageSize = 10
      this.searchInfo.pageNo = 1
      this.init()
    },
    init () {
      findPersonneOutList(this.searchInfo).then(res => {
        if (res.data.errcode === 0) {
          this.list = res.data.data.results
          this.searchInfo.totalnum = res.data.data.totalRecord
        } else {
          this.$Notice.error({ title: '列表获取失败', desc: res.data.errmsg })
        }
      })
    },
    changePagesize (pageSize) {
      this.searchInfo.pageSize = pageSize
      this.changePageNo(1)
    },
    changePageNo (pageNo) {
      this.searchInfo.pageNo = pageNo
      this.init()
    },
    findTypeList () {
      let param1 = { // 人员类型
        pid: '10001'
      }
      let param2 = { // 人员状态
        pid: '10007'
      }
      getTypeList(param1).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.typeList = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param2).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.statusList = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
    },
    checkInfo (item) {
      this.$router.push({
        path: '/personnel-info',
        query: { id: item.id }
      })
    },
    checkInfDraft (item) {
      this.$router.push({
        path: '/personnel-info',
        query: { id: item.id, card_no: false }
      })
    },
    transfer (item) {
      this.transferInfo = item
      // this.transferIfo.
      this.getMailList(2,null)
      this.getMailList3(2,null)
      this.getMailList4(4,item.city_code)
      this.getMailList4(5,item.street_code)
      this.transferInfo.out_city_code = item.city_code
      this.transferInfo.out_street_code = item.street_code
      this.transferInfo.out_community_code = item.community_code
      this.transferInfo.put_city_code = null
      this.transferInfo.put_street_code = null
      this.transferInfo.put_community_code = null
      this.transferModal = true
    },
    okTransfer () {
      updateWorkerMobilize(this.transferInfo).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({ title: '操作完成' })
          this.init()
        } else {
          this.$Notice.error({ title: '人员调动失败', desc: res.data.errmsg })
        }
      })
    },
    getMailList (grade, code) {
      // this.searchInfo['grade' + (index + 1)] = 0
      getOffice({ grade: grade, code: code }).then(res => {
        if (res.data.errcode === 0) {
          this.mailList1 = res.data.data
          let xiehui = {code: "1", name: "社区工作者协会", master: "社区工作者协会"}
          this.mailList1.push(xiehui)
          // this.mailList[index].unshift({ id: 0, title: '全部' })
          // this.$forceUpdate()
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '查询区域列表信息失败' })
        }
      })
    },
    getMailList2 (grade, code) {
      // this.searchInfo['grade' + (index + 1)] = 0
      getOffice({ code: code }).then(res => {
        if (res.data.errcode === 0) {
          if (grade === 4) {
            this.mailList2 = res.data.data
            let xiehui = {code: "1", name: "社区工作者协会", master: "社区工作者协会"}
            this.mailList2.push(xiehui)
          } else if (grade === 5) {
            this.mailList3 = res.data.data
          }
          // this.mailList[index].unshift({ id: 0, title: '全部' })
          // this.$forceUpdate()
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '查询区域列表信息失败' })
        }
      })
    },
    // 社区统计下拉搜索框的级联查询
    getMailList3 (grade, code) {
      // this.searchInfo['grade' + (index + 1)] = 0
      getOffice({ grade: grade, code: code }).then(res => {
        if (res.data.errcode === 0) {
          this.mailList5 = res.data.data
          let xiehui = {code: "1", name: "社区工作者协会", master: "社区工作者协会"}
          this.mailList5.push(xiehui)
          // this.mailList[index].unshift({ id: 0, title: '全部' })
          // this.$forceUpdate()
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '查询区域列表信息失败' })
        }
      })
    },
    getMailList4 (grade, code) {
      // this.searchInfo['grade' + (index + 1)] = 0
      getOffice({ code: code }).then(res => {
        if (res.data.errcode === 0) {
          if (grade === 4) {
            this.mailList6 = res.data.data
            let xiehui = {code: "1", name: "社区工作者协会", master: "社区工作者协会"}
            this.mailList6.push(xiehui)
          } else if (grade === 5) {
            this.mailList7 = res.data.data
          }
          // this.mailList[index].unshift({ id: 0, title: '全部' })
          // this.$forceUpdate()
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '查询区域列表信息失败' })
        }
      })
    },
    getTransfer (item, event_type) {
      this.transferInfo = item
      this.transferInfo.event_type = event_type
      // this.transferIfo.
      this.transferInfo.out_city_code = item.city_code
      this.transferInfo.out_street_code = item.street_code
      this.transferInfo.out_community_code = item.community_code
      this.getMailList(2,null)
      this.getMailList3(2,null)
      this.getMailList4(4,item.city_code)
      this.getMailList4(5,item.street_code)
      this.transferInfo.put_city_code = null
      this.transferInfo.put_street_code = null
      this.transferInfo.put_community_code = null
      if (event_type === '2') {
        this.status = false
        this.status2 = true
        this.transferInfo.put_city_code = item.city_code
        this.getMailList2(4,item.city_code)
      } else if (event_type === '3') {
        this.status = false
        this.status2 = false
        this.transferInfo.put_city_code = item.city_code
        this.transferInfo.put_street_code = item.street_code
        this.getMailList2(4,item.city_code)
        this.getMailList2(5,item.street_code)
      }
      console.log(this.transferInfo,'ppppp')
      this.transferModal2 = true
    },
    okTransfer2 () {
      updatePersonnelWorker(this.transferInfo).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({ title: '人员调动成功', desc: '' })
          this.init()
        } else {
          this.$Notice.error({ title: '操作失败!', desc: res.data.message })
        }
      })
    },
    getInfo (item) {
      this.$router.push({
        path: '/personnel-info',
        query: { id: item.id, disabledInfo: true }
      })
    },
    getLabelList () { // 获取字典数据
      let param1 = { // 婚姻
        pid: '10006'
      }
      let param2 = { // 民族
        pid: '10008'
      }
      let param3 = { // 政治面貌
        pid: '10009'
      }
      let param4 = { // 党委职务
        pid: '10002'
      }
      let param5 = { // 居委职务
        pid: '10003'
      }
      let param6 = { // 监委职务
        pid: '10004'
      }
      let param7 = { // 协会职务
        pid: '10005'
      }
      let param8 = { // 最高学历
        pid: '10010'
      }
      let param9 = { // 学位
        pid: '10011'
      }
      let param10 = { // 学位
        pid: '10012'
      }
      let param11 = { // 亲属关系
        pid: '10015'
      }
      let param12 = { // 考核结果
        pid: '10014'
      }
      let param13 = { // 考核信息
        pid: '10013'
      }
      let param14 = { // 离职原因
        pid: '10016'
      }
      getTypeList(param1).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.hunyin = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param2).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.minzu = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param3).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.zzmm = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param4).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.dwzw = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param5).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.jvwzw = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param6).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.jwzw = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param7).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.xhzw = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param8).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.zgxl = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param9).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.xw = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param10).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.shgzs = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param11).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.qsgx = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param12).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.khjg = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param13).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.khxx = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
      getTypeList(param14).then(res => {
        if (res.data.errcode === 0) {
          this.labelList.lzyy = res.data.data
          return
        }
        this.$Notice.error({ title: '查询失败' })
      })
    },
    deleteInfo (item) {
      let params = {
        id: item.id
      }
      if (confirm('是否删除此条草稿信息，删除后信息无法恢复'))
      deleteDraft(params).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.error({ title: '操作成功', desc: '' })
          this.init()
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: res.data.errmsg })
        }
      })
    },
    logOut (item) {
      this.deleteData = {
        lzyy: '',
        lzyy_other: '',
        id: item.id
      }
      this.logOutShow = true
    },
    changeCancellation () {
      this.deleteData.lzyy_other = ''
    },
    logOutOk () {
      let params = {
        id: this.deleteData.id,
        lzyy: this.deleteData.lzyy,
        lzyy_other: this.deleteData.lzyy_other
      }
      if (confirm('人员注销后信息不可恢复，是否继续')) {
        updateLogOut(params).then(res => {
          if (res.data.errcode === 0) {
            this.$Notice.error({ title: '操作成功'})
          } else {
            this.$Notice.error({ title: '操作失败', desc: res.data.errmsg })
          }
        })
      }
    },
    getQuota (item) {
      this.$refs.chile.selectDifference(item)
    },
    getHistoryQuota (item) {
      item.ID = item.id
      this.$refs.history.checkPersonnelInfoList(item)
    }
  },
  mounted() {
    this.init()
    this.findTypeList()
    this.getLabelList()
    this.companyGrade = this.$store.state.user.severUserInfo.company_grade
  }
}
</script>
<style>
.page_style {
  margin-top: 10px;
  text-align: right;
}
.bench_search {
  margin-bottom: 10px;
}
.search-info-style{
  margin-top: 10px;
}
.new-btn-sty {
  margin-right: 5px;
  color: #fff;
  background-color: #235CA7;
  border-color: #235CA7;
  font-weight: 500;
}
</style>
